//package data.dep;
//
//import java.io.BufferedReader;
//import java.io.FileReader;
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Random;
//
//import data.crawling.Builder;
//import data.crawling.PageCrawler;
//import data.crawling.TBoxBuilder;
//
//import entities.vocabulary.Display;
//import entities.vocabulary.KBVocabulary;
//
//
//public class AssertionBuilder extends Builder {
//
//	//private String output_filename;
//	private boolean test = false;
//	private static int instanceName = 0;
//	private static HashMap<String, String> vendorindex = new HashMap<String, String>();
//	
//	public AssertionBuilder(){
//	}
//
//	public String buildAssertions(HashMap<String, String> cam){
//		System.out.println("Cam size:"+cam.size());
//		String lhs = "";
//		String rhs = " (and ";
//		String res = " (forall (role "+Builder.RESOLUTIONROLE+") (and ";
//		String pv ="";
//		String sensorcp = " (and "+TBoxBuilder.Sensor+" ";
////		String sensorman = "";
//		for(String f:cam.keySet()){	
////			System.out.println("f/v:"+f+cam.get(f));
//			if(f.compareToIgnoreCase(Builder.CAMERANAME)==0){
//				lhs = normalizeString(cam.get(f));
//				//find its manufacturer
//				String man = lhs.substring(0, lhs.indexOf('_'));
//				if(man.contains("Konica")){
//					man = "Konica_Minolta";
//				}
//				rhs += " (exists (role "+TBoxBuilder.hasMan+") "+man+")";
//			}else
//			if(f.contains("Image stabilization")){
//				String v = cam.get(f);
//				rhs += " (exists (role "+TBoxBuilder.hasIS+") ";
//				if(v.contains("Lens")){
//					//optical/mechanical IS
//					rhs += TBoxBuilder.ISop;
//				}else if(v.contains("shift")){
//					//sensor shift IS/anti-shake
//					rhs += TBoxBuilder.ISsensor;
//				}else if(v.contains("No")){
//					//bottom
//					rhs += KBVocabulary.BOTTOM;
//				}else{
//					rhs += TBoxBuilder.UNKNOWNIS;
//				}
//				rhs += ")";
//			}else
////			if(f.contains("Sensor manufacturer")){
////				sensorman = cam.get(f);
////			}else
//			if(f.contains("Sensor type")){
//				String type = cam.get(f);
//				if(type.contains("CCD")){
//					sensorcp += " (forall (role "+TBoxBuilder.hasSensorType +") "+TBoxBuilder.Typeccd+")";
//				}else if(type.contains("CMOS")){
//					sensorcp += " (forall (role "+TBoxBuilder.hasSensorType +") "+TBoxBuilder.Typeapscmos+")";
//				}else if(type.contains("JEFT")){
//					sensorcp += " (forall (role "+TBoxBuilder.hasSensorType +") "+TBoxBuilder.Typeapsother+")";
//				}
//			}else
//			if(f.contains("Sensor photo detectors") || f.contains("Sensor size")){
//					sensorcp += " (= (role " + normalizeString(f.substring(0, f.indexOf(PageCrawler.identifier)))+") "+normalizeString(cam.get(f))+") ";
//			}else				
//			if(f.compareToIgnoreCase(Builder.CAMTYPE) == 0){
//				String v = cam.get(f);
//				String format = "";
//				if(v.contains("SLR")){
//					format = TBoxBuilder.DLSR;
//				}else if(v.contains("Interchangeable")){
//					format = TBoxBuilder.Hybrid;
//				}else {
//					format = TBoxBuilder.DC;
//				}
//				rhs += " "+format+" ";
//			}else
//			if(f.equals(Builder.USERREVIEW)){
//				//reviews are added differently
//				rhs += "(forall (role "+Builder.REVIEWROLE+") "+cam.get(f)+" )";
//			}else 
//				if(f.equalsIgnoreCase(Builder.MAXRESOLUTION) ||
//					f.equalsIgnoreCase(Builder.LOWRESOLUTION)){
//				res += "(forall (role "+(f.equalsIgnoreCase(Builder.MAXRESOLUTION)?  Builder.MAXRESOLUTION: Builder.LOWRESOLUTION)
//					+") " + this.getResolution(cam.get(f)) +" )";
//				if(this.test){
//					System.out.println("Err in XxY: "+f);
//					this.test = false;
//				}
//				//System.out.println(ws);
//			}else if(f.equalsIgnoreCase(Builder.PRICEVENDORINFO)){
//					pv = cam.get(f);
//			}
//			else
//			{
//				if(f.contains(PageCrawler.identifier)){
//					//this is a role candidate
//					String[] fs = f.split(PageCrawler.identifier);
//					if(fs.length != 2){
//						System.err.println("Error! The role candidate is not followed by the identitfier: "+f);
//					}else{
//						String r = fs[0];
//						r = Builder.normalizeString(Builder.stringToConcept(r));
//						String ref = Builder.normalizeString(Builder.stringToConcept(fs[1]));
//						String filler = cam.get(f).trim();
//						//test if the value exists, if not 
//						filler ="(and " + ref+" (= (role "+r+Builder.VALUEFEATURE+") "
//							+normalizeString(filler)+") )" ;
////						if(filler.compareToIgnoreCase("No") == 0
////								||filler.compareToIgnoreCase("None") == 0){
////							
////						}
//						rhs += "(forall (role has"+r+ ") "+ filler +")";
//						//rhs += ")";	
//					}
//				}else{
//					//this is a feature candidate
//					rhs += "(= (role " + normalizeString(f)+") "+normalizeString(cam.get(f))+") ";
//				}
//					
//			}
//		}
//		res += " ))";
//		rhs += res;
//		rhs += ") ";
//		this.createVendorPrice(lhs, pv);
//		String ws = "(concept-assertion "+lhs +" " +rhs +" )";
//		this.writeStringToFile(ws, false);
//		return ws;
//	}
//	
//
//	
//
//
//	
//	
//	
//
//
//	
//	
//	
//	
//	
//}

